<?php
namespace app\model;

use think\Model;

class Product extends Model
{
    protected $_autoWriteTimestamp = true; // 自动写入时间戳
    protected $_createTime         = 'create_time';
    protected $_updateTime         = 'update_time';
    protected $_deleteTime         = 'delete_time'; // 软删除

    // 定义关联关系
    public function category()
    {
        return $this->belongsTo(Category::class); // 关联Category模型，外键为category_id，主键为id
    }
}
